







[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Finds the first item in a collection that satisfies the condition
defined by predicate.
Namespace: Wintellect.PowerCollections
Assembly:
PowerCollections (in PowerCollections.dll)
Syntax
C# |
---|
public static T FindFirstWhere<T>( IEnumerable<T> collection, Predicate<T> predicate ) |
Visual Basic (Declaration) |
---|
Public Shared Function FindFirstWhere(Of T) ( _ collection As IEnumerable(Of T), _ predicate As Predicate(Of T) _ ) As T |
Visual C++ |
---|
public: generic<typename T> static T FindFirstWhere ( IEnumerable<T>^ collection, Predicate<T>^ predicate ) |
Parameters
- collection
- IEnumerable<(Of <T>)>
The collection to search.
- predicate
- Predicate<(Of <T>)>
A delegate that defined the condition to check for.
Return Value
The first item in the collection that matches the condition, or the default value for T (0 or null) if no item that matches the condition is found.
Type Parameters
- T
Remarks
If the default value for T could be present in the collection, and
would be matched by the predicate, then this method is inappropriate, because
you cannot disguish whether the default value for T was actually present in the collection,
or no items matched the predicate. In this case, use TryFindFirstWhere.